package com.shiyun.marker.meta;

import cn.hutool.core.io.resource.ResourceUtil;
import cn.hutool.json.JSONUtil;

public class MetaManager {
    private static volatile Meta meta;
    private MetaManager(){

    }
    public static Meta getMetaObject(){
        if(meta == null) {
            synchronized (MetaManager.class) {
                if(meta == null) {
                    meta = initMeta();
                }
            }
        }
        return meta;
    }
    private static Meta initMeta(){
        String metaJSON = ResourceUtil.readUtf8Str("meta.json");
        Meta newMeta = JSONUtil.toBean(metaJSON,Meta.class);
        Meta.FileConfig fileConfig = newMeta.getFileConfig();
        return newMeta;
    }
}
